package com.ruoyi.web.controller.boc;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.boc.domain.BocLakeTableColumn;
import com.ruoyi.boc.service.IBocLakeTableColumnService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 入湖字段Controller
 * 
 * @author ruoyi
 * @date 2025-02-17
 */
@RestController
@RequestMapping("/boc/lakeTableColumn")
public class BocLakeTableColumnController extends BaseController
{
    @Autowired
    private IBocLakeTableColumnService bocLakeTableColumnService;

    /**
     * 查询入湖字段列表
     */
    @PreAuthorize("@ss.hasPermi('boc:lakeTableColumn:list')")
    @GetMapping("/list")
    public TableDataInfo list(BocLakeTableColumn bocLakeTableColumn)
    {
        startPage();
        List<BocLakeTableColumn> list = bocLakeTableColumnService.selectBocLakeTableColumnList(bocLakeTableColumn);
        return getDataTable(list);
    }

    /**
     * 导出入湖字段列表
     */
    @PreAuthorize("@ss.hasPermi('boc:lakeTableColumn:export')")
    @Log(title = "入湖字段", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BocLakeTableColumn bocLakeTableColumn)
    {
        List<BocLakeTableColumn> list = bocLakeTableColumnService.selectBocLakeTableColumnList(bocLakeTableColumn);
        ExcelUtil<BocLakeTableColumn> util = new ExcelUtil<BocLakeTableColumn>(BocLakeTableColumn.class);
        util.exportExcel(response, list, "入湖字段数据");
    }

    /**
     * 获取入湖字段详细信息
     */
    @PreAuthorize("@ss.hasPermi('boc:lakeTableColumn:query')")
    @GetMapping(value = "/{columnId}")
    public AjaxResult getInfo(@PathVariable("columnId") Long columnId)
    {
        return success(bocLakeTableColumnService.selectBocLakeTableColumnByColumnId(columnId));
    }

    /**
     * 新增入湖字段
     */
    @PreAuthorize("@ss.hasPermi('boc:lakeTableColumn:add')")
    @Log(title = "入湖字段", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BocLakeTableColumn bocLakeTableColumn)
    {
        return toAjax(bocLakeTableColumnService.insertBocLakeTableColumn(bocLakeTableColumn));
    }

    /**
     * 修改入湖字段
     */
    @PreAuthorize("@ss.hasPermi('boc:lakeTableColumn:edit')")
    @Log(title = "入湖字段", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BocLakeTableColumn bocLakeTableColumn)
    {
        return toAjax(bocLakeTableColumnService.updateBocLakeTableColumn(bocLakeTableColumn));
    }

    /**
     * 删除入湖字段
     */
    @PreAuthorize("@ss.hasPermi('boc:lakeTableColumn:remove')")
    @Log(title = "入湖字段", businessType = BusinessType.DELETE)
	@DeleteMapping("/{columnIds}")
    public AjaxResult remove(@PathVariable Long[] columnIds)
    {
        return toAjax(bocLakeTableColumnService.deleteBocLakeTableColumnByColumnIds(columnIds));
    }

}
